import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {  ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { CommonModule } from '@angular/common';
// import core module
import { CoreModule } from './core/core.module';
// import effect module
import { EffectsModule } from '@ngrx/effects';
import { AuthenticationEffects } from './auth/effects/auth.effects';
// import root component
import { AppComponent } from './app.component';
// import root routing
import { AppRoutingModule } from './app.router';
// import app reducer
import { reducers } from './app.reducer';
import { authReducer } from './auth/reducers/auth.reducer';
import { ProductModule } from './product/product-module';
import { UserModule } from './auth/user.module';
// import layout component
import { LayoutComponentModule } from './layout/layout.module';
import { HomeModule } from './home/home.module';
// import store module reducer
import { StoreModule } from '@ngrx/store';
// import animations
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
//import breadcrumb navigation
import { BreadcrumbComponent } from './share/breadcrumb/breadcrumb.component';
// import rxjs operator
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/finally';
import 'rxjs/add/operator/delay';
import 'rxjs/add/observable/of';
// import translate module
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateLoader, TranslateModule, TranslateStaticLoader } from 'ng2-translate/ng2-translate';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { SharedModule } from './share/shared.module';
// import toastr module
import { ToastModule } from 'ng2-toastr/ng2-toastr';

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

@NgModule({
  declarations: [
    AppComponent,
    BreadcrumbComponent,
  ],
  imports: [
    BrowserModule,
    CommonModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    StoreModule.forRoot(reducers),
    ProductModule,
    UserModule,
    LayoutComponentModule,
    HomeModule,
    ReactiveFormsModule,
    StoreModule,
    CoreModule,
    HttpModule,
    EffectsModule.forRoot([AuthenticationEffects]),
    // TranslateModule.forRoot({
    //   provider: TranslateLoader,
    //   useFactory: (HttpLoaderFactory),
    //   deps: [HttpClient]
    // })
    SharedModule,
    ToastModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
